package com.yituo.mjworld.mvc.dao;

import com.yituo.mjworld.core.utils.BaseDao;
import com.yituo.mjworld.mvc.entity.web.WebChildItem;
import org.springframework.stereotype.Repository;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Repository
public class ChildItemDao extends BaseDao {
  /**
   * 标题是否已经存在!
   *
   * @return
   */
  public WebChildItem getChildItemByTitle(String title) {
    // 新增操作
    String hql = "from WebChildItem where title=:title ";
    Map<String, Object> params = new HashMap<String, Object>(1);
    params.put("title", title);
    List<WebChildItem> list = findByHql(hql, params);
    if (list != null && list.size() > 0) {
      return list.get(0);
    }
    return null;
  }
}
